const Index = ({ table_name, database, tableRef }) =>{
	return  {
		modal:{
			title: <span>表【<b className='c3'>{ table_name }</b>】主键列表</span>,
			width: '60%',
			maxWidth:null,
			controls: 0
		},
		table: {
			api:'mysql/show_key',
			param: { table_name, database },
			isIndex: 1,
			paging:0,
			cols:[
				{ title: '字段名', 			dataIndex: 'Column_name', 				width:100, render: t => <b className='ar f13'>{t}</b> },
				{ title: '主键名', 			dataIndex: 'Key_name', 					width:100, render: t =>{
					return t === 'PRIMARY' ? <b className='ar f13 c3'>{t}</b> : <b className='ar f13 c0'>{t}</b>
				} },
				{ title: '索引类型', 		dataIndex: 'Index_type', 				width:100, align:'center', render: t => <i>{t.toLowerCase()}</i>  },
				
				{ title: '索引排序', 		dataIndex: 'Seq_in_index', 				width:100, align:'center' },
				
				{ title: '字段值是否唯一', 	dataIndex: 'Non_unique', 				width:100, align:'center', render: t => !t ? <i>是</i> : <i className='g9'>否</i> },
				{ title: '是否可见', 		dataIndex: 'Visible', 					width:100, align:'center' },
				{ title: '注释', 			dataIndex: 'Index_comment', 			width:100 },
			],
			controls 	: {
				width: 80,
				data:  ({ Key_name, Table }) => [
					{ label:'删除', mode:'delPop', abs:0, way:'put', msg:<span>是否删除【<b className='ar c3'>{Key_name}</b>】索引?</span>, r:1, api:'mysql/structure/del_key', 
						param:{ table_name:Table, database, key_name: Key_name.toLowerCase() },
						onOk : () => {
							window.$.ref(tableRef).tableRef().search({ scroll:0 })
						}
					},
				]
			}
		}
	}
}
export default Index